From a445fa3d1e63192e8353a28a034cb718ac1a5d36 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 12 Feb 2008 18:58:06 +0000 Subject: [PATCH] DG-100: Read in bulk mode when we can. Mac/Linux serial: don't reset timeout as often to trigger fewer driver bugs. Lowrance: add read support for v3 files. WBT doc: update. --- gpsbabel/dg-100.c | 11 ++++++++++- gpsbabel/gbser_posix.c | 11 ++++++++++- gpsbabel/lowranceusr.c | 9 ++++++++- gpsbabel/xmldoc/formats/wbt-bin.xml | 4 ++-- gpsbabel/xmldoc/formats/wbt.xml | 23 ++++++++++++++++++++--- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/gpsbabel/dg-100.c b/gpsbabel/dg-100.c index 02877cee0..046369674 100644 --- a/gpsbabel/dg-100.c +++ b/gpsbabel/dg-100.c @@ -3,7 +3,7 @@ GlobalSat DG-100 GPS data logger download. Copyright (C) 2007 Mirko Parthey, mirko.parthey@informatik.tu-chemnitz.de - Copyright (C) 2005 Robert Lipe, robertlipe@usa.net + Copyright (C) 2005-2008 Robert Lipe, robertlipe@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -432,10 +432,19 @@ dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload) /* TODO: Since we know how long the frame should be, we could try to * read the rest of the frame at once using gbser_read_wait(). */ +#if 0 for (i = 7; i < frame_len; i++) { buf[i] = dg100_recv_byte(); dg100_debug("", 0, 1, &buf[i]); } +#else + i = gbser_read_wait(serial_handle, &buf[7], frame_len - 7, 1000); + dg100_debug("", 0, frame_len - 7, &buf[7]); + if (i < frame_len - 7) { + fatal("Expected to read %d bytes, but got %d\n", + frame_len - 7, i); + } +#endif frame_start_seq = be_read16(buf + 0); payload_len_field = be_read16(buf + 2); diff --git a/gpsbabel/gbser_posix.c b/gpsbabel/gbser_posix.c index c2c6cab3c..4667ffce3 100644 --- a/gpsbabel/gbser_posix.c +++ b/gpsbabel/gbser_posix.c @@ -305,7 +305,16 @@ int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) { vmin = want - h->inbuf_used; vtime = (unsigned) time_left / 100; } - if ((rc = set_rx_timeout(h, vmin, vtime), rc < 0) || + // The commented out call to set_rx_timeout here is totally + // legal by POSIX standards but does result in a flurry of + // of tcsetattrs that slightly tweak VMIN/VTIME while there + // is incoming data. This has been shown to trigger driver + // bugs in the Prolific drivers for Mac and in certain Linux + // kernels, thought the latter has since been fixed. + // So althogh removing this means that the timeout behaviour + // is actually different on POSIX and WIN32, it triggers + // fewer buts this way. 2/12/2008 RJL + if (/* (rc = set_rx_timeout(h, vmin, vtime), rc < 0) || */ (rc = read(h->fd, h->inbuf + h->inbuf_used, want - h->inbuf_used), rc < 0)) { return gbser_ERROR; diff --git a/gpsbabel/lowranceusr.c b/gpsbabel/lowranceusr.c index 86394ca41..b7a11b0af 100644 --- a/gpsbabel/lowranceusr.c +++ b/gpsbabel/lowranceusr.c @@ -2,7 +2,7 @@ Access to Lowrance USR files. Contributed to gpsbabel by Jason Rust (jrust at rustyparts.com) - Copyright (C) 2005, 2006 Robert Lipe, robertlipe@usa.net + Copyright (C) 2005, 2006, 2007, 2008 Robert Lipe, robertlipe@usa.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -176,6 +176,7 @@ static char *ignoreicons; static char *writeasicons; static char *merge; static char *seg_break; +static int reading_version; #define MYNAME "Lowrance USR" @@ -368,6 +369,11 @@ lowranceusr_parse_waypt(waypoint *wpt_tmp) if (global_opts.debug_level >= 1) printf(MYNAME " parse_waypt: waypt_type = %d\n",waypt_type); + // Version 3 has an extra word in here that we don't know about. + if (reading_version >= 3) { + int junkword = gbfgetint32(file_in); + (void)junkword; + } } @@ -558,6 +564,7 @@ data_read(void) int i; MajorVersion = gbfgetint16(file_in); + reading_version = MajorVersion; MinorVersion = gbfgetint16(file_in); if (global_opts.debug_level >= 1) diff --git a/gpsbabel/xmldoc/formats/wbt-bin.xml b/gpsbabel/xmldoc/formats/wbt-bin.xml index 94509a517..867822664 100644 --- a/gpsbabel/xmldoc/formats/wbt-bin.xml +++ b/gpsbabel/xmldoc/formats/wbt-bin.xml @@ -1,8 +1,8 @@ File protocol for the Wintec WBT-200 -GPS data logger. This format reads the binary file format created +and Wintec WBT-201 (sometimes called the G-Rays 2)GPS data loggers. This format reads the binary file format created by Wintec's Windows application. -Wintec WBT-200 +Wintec WBT-201 Command showing conversion of a Wintec binary file to GPX diff --git a/gpsbabel/xmldoc/formats/wbt.xml b/gpsbabel/xmldoc/formats/wbt.xml index fb6a96256..8a1845077 100644 --- a/gpsbabel/xmldoc/formats/wbt.xml +++ b/gpsbabel/xmldoc/formats/wbt.xml @@ -1,9 +1,26 @@ -Serial download protocol for the Wintec WBT-200 GPS data logger. Although untested it is expected that this will also support the WBT-100. +Serial download protocol for the +Wintec WBT-200 and +Wintec WBT-201 +GPS data loggers. Although untested it is expected that this will also support the WBT-100. -Wintec WBT-200 +Wintec WBT-201 Command showing WBT-200 download and erase over Bluetooth on Mac OS X gpsbabel -t -w -i wbt,erase -f /dev/cu.WBT200-SPPslave-1 -o gpx -F out.gpx - + + +Internally, this is actually a serial device that has a serial/USB adapter +built into it. It uses the CP210x chip by Silicon labs. You will probably +need a driver for this chip. The product ships with one for Windows. +The Linux 210x driver seems to work fine. Mac users will need to download +the Mac driver for CP210x. + + + +GPSBabel does not try to offer an interface to configure these units. That +is left to the Windows software that comes with it or tools like the +WBT 201 Viewer for Mac OS/X +and Linux. + -- 2.30.2